%module PyDGGS

%{
#include"../LibDGGSBase/BaseDefine.hpp"
#include"../LibDGGSBase/MathDefine.hpp"
#include"../LibDGGSBase/DGGSDefine.hpp"
#include"../LibDGGSKernel/Projection/Project.hpp"
#include"../LibDGGSKernel/QueryResult.hpp"
#include"../LibDGGSKernel/IDGGSKernel.hpp"
#include"../LibDGGSKernel/ISEA4H/ISEA4HImpl.hpp"
#include"../LibDGGSKernel/ISEA4D/ISEA4DImpl.hpp"
#include"../LibDGGSKernel/ISEA4T/ISEA4TImpl.hpp"

#include"../LibDGGSFeature/DGGSGeometry.hpp"
#include"../LibDGGSFeature/DGGSFeatureClass.hpp"
#include"../LibDGGSFeature/DGGSFeatureLayer.hpp"
#include"../LibDGGSFeature/DGGSFeature.hpp"
#include"../LibDGGSFeature/DGGSPoint.hpp"
#include"../LibDGGSFeature/DGGSPolyLine.hpp"
#include"../LibDGGSFeature/DGGSPolygon.hpp"

#include"../LibDGGSField/DGGSFieldLayer.hpp"
#include"../LibDGGSField/DGGSFieldBand.hpp"
#include"../LibDGGSField/DGGSFieldPartition.hpp"

#include"../LibDGGSFieldPyramid/FieldPyramidDefine.hpp"
#include"../LibDGGSFieldPyramid/IFieldPyramidKernel.hpp"
#include"../LibDGGSFieldPyramid/DGGSFieldPyramidImpl.hpp"
#include"../LibGridTIFF/GridTIFF.hpp"

#include"../DGGSUtility/Utility.hpp"
%}

%ignore NNU::DGGS::DGGridBBox::operator=;
%ignore NNU::DGGS::Field::DGGSFieldLayer::operator=;
%ignore NNU::DGGS::Field::DGGSFieldBand::operator=;
%ignore NNU::DGGS::Field::DGGSFieldPartition::operator=;
%ignore NNU::DGGS::enum2String;

%apply int& OUTPUT { int& x, int& y };  // ���� int& ��Ϊ�������
%apply int& INPUT { int& x, int& y };   // ���� int& ��Ϊ�������

%include <std_vector.i>

%include"../LibDGGSBase/BaseDefine.hpp"
%include"../LibDGGSBase/MathDefine.hpp"
%include"../LibDGGSBase/DGGSDefine.hpp"

%template(DGGSElementCodeVector) std::vector<NNU::DGGS::Base::DGGSElementCode>;

%include"../LibDGGSKernel/QueryResult.hpp"
%include"../LibDGGSKernel/IDGGSKernel.hpp"

%include"../LibDGGSFeature/DGGSGeometry.hpp"
%include "../LibDGGSFeature/DGGSFeatureClass.hpp"
%include"../LibDGGSFeature/DGGSFeatureLayer.hpp"
%include"../LibDGGSFeature/DGGSFeature.hpp"
%include"../LibDGGSFeature/DGGSPoint.hpp"
%include"../LibDGGSFeature/DGGSPolyLine.hpp"
%include"../LibDGGSFeature/DGGSPolygon.hpp"

%include "../LibDGGSField/DGGSFieldLayer.hpp"
%include "../LibDGGSField/DGGSFieldBand.hpp"
%include"../LibDGGSField/DGGSFieldPartition.hpp"
%include"../LibGridTIFF/GridTIFF.hpp"
%include"../LibDGGSFieldPyramid/FieldPyramidDefine.hpp"
%include"../LibDGGSFieldPyramid/IFieldPyramidKernel.hpp"

namespace NNU::DGGS{
        namespace Field{
            %template(DGGSFieldLayerUnsignedShort) DGGSFieldLayer<unsigned short>;
            %template(DGGSFieldLayerShort) DGGSFieldLayer<short>;
            %template(DGGSFieldLayerUnsignedInt) DGGSFieldLayer<unsigned int>;
            %template(DGGSFieldLayerInt) DGGSFieldLayer<int>;
            %template(DGGSFieldLayerFloat) DGGSFieldLayer<float>;
            %template(DGGSFieldLayerDouble) DGGSFieldLayer<double>;
            %template(DGGSFieldLayerUnsignedChar) DGGSFieldLayer<unsigned char>;

            %template(DGGSFieldBandUnsignedShort) DGGSFieldBand<unsigned short>;
            %template(DGGSFieldBandShort) DGGSFieldBand<short>;
            %template(DGGSFieldBandUnsignedInt) DGGSFieldBand<unsigned int>;
            %template(DGGSFieldBandInt) DGGSFieldBand<int>;
            %template(DGGSFieldBandFloat) DGGSFieldBand<float>;
            %template(DGGSFieldBandDouble) DGGSFieldBand<double>;
            %template(DGGSFieldBandUnsignedChar) DGGSFieldBand<unsigned char>;

            %template(DGGSFieldPartitionUnsignedShort) DGGSFieldPartition<unsigned short>;
            %template(DGGSFieldPartitionShort) DGGSFieldPartition<short>;
            %template(DGGSFieldPartitionUnsignedInt) DGGSFieldPartition<unsigned int>;
            %template(DGGSFieldPartitionInt) DGGSFieldPartition<int>;
            %template(DGGSFieldPartitionFloat) DGGSFieldPartition<float>;
            %template(DGGSFieldPartitionDouble) DGGSFieldPartition<double>;
            %template(DGGSFieldPartitionUnsignedChar) DGGSFieldPartition<unsigned char>;
    }
};


%inline %{

double* new_array(int size) {
    return new double[size];
}

static void delete_array(double* arr) {
    delete[] arr;
}

double get_item(double* arr, int index) {
    return arr[index];
}

void set_item(double* arr, int index, double value) {
    arr[index] = value;
}

%}